package tx.com.combat;

public class LeagueThread extends Thread {
	GameView gameView;
	boolean flag = true;
	boolean whileFlag = true;
	
	public LeagueThread(GameView gameView){
		this.gameView = gameView;
	}
	
	public void run(){
		while(whileFlag){
			if(flag){
				synchronized(gameView.aliveLeague){
					for(League league:gameView.aliveLeague){
						league.MoveNext();
					}
					gameView.aliveLeague.removeAll(gameView.deathLeague);
					gameView.aliveLeague.removeAll(gameView.deathLeague);
					
					gameView.deathLeague.clear();
				}
			}
			try{
				Thread.sleep(10);
			}catch(Exception e){
				e.printStackTrace();
			}
		}
	}
	
	public void SetFlag(boolean flag){
		this.flag = flag;
	}
	
	public void SetWhileFlag(boolean whileFlag){
		this.whileFlag = whileFlag;
	}
	
	public double GetLength(){
		double result = 0.0;
		return result;
	}
}
